
package com.audi.activiey.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import net.sf.oval.constraint.Length;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;


@Entity
@Table(name = "tbl_activity_affix")
public class ActivityAffix implements java.io.Serializable{
    
	private static final long serialVersionUID = 5454155825314635342L;
	
    /**
     * affixId       db_column: affix_id 
     * 活动附件id
     */ 	
	private Long affixId;
    /**
     * activityId       db_column: activity_id 
     * 所对应的活动
     */ 	
	
	private Long activityId;
    /**
     * type       db_column: type 
     * 上传资源类型  1 活动图片 2 活动附件 3.活动连接
     */ 	
	@Length(max=16)
	private java.lang.String type;
    /**
     * value       db_column: value 
     * 1.图片：
     * 图片保存的url地址，小图大图按保存同一文件名，不同的路径，如:big/yyyymmdd/123.jpg表示大图，small/yyyymmdd/123.jpg表示小图
     * 2.附件：附件地址
     * 3.连接：连接地址
     */ 	
	@Length(max=128)
	private java.lang.String value;
    /**
     * createTime       db_column: create_time 
     */ 	
	
	private java.util.Date createTime;
	//columns END


	public ActivityAffix(){
	}

	public ActivityAffix(
		Long affixId
	){
		this.affixId = affixId;
	}

	

	public void setAffixId(Long value) {
		this.affixId = value;
	}
	
	@Id 
	/*@SequenceGenerator(name="activity_affix_SEQ",sequenceName="seq_activity_affix")
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="activity_affix_SEQ") */
	
    @GenericGenerator(name="custom-id", strategy = "identity")
	@GeneratedValue(generator="custom-id")
	@Column(name = "affix_id")
	public Long getAffixId() {
		return this.affixId;
	}
	
	@Column(name = "activity_id")
	public Long getActivityId() {
		return this.activityId;
	}
	
	public void setActivityId(Long value) {
		this.activityId = value;
	}
	
	@Column(name = "type",length=16)
	public java.lang.String getType() {
		return this.type;
	}
	
	public void setType(java.lang.String value) {
		this.type = value;
	}
	
	@Column(name = "value",length=512)
	public java.lang.String getValue() {
		return this.value;
	}
	
	public void setValue(java.lang.String value) {
		this.value = value;
	}
	
	
	@Column(name = "create_time", updatable = true)
	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	
	public void setCreateTime(java.util.Date value) {
		this.createTime = value;
	}
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("AffixId",getAffixId())
			.append("ActivityId",getActivityId())
			.append("Type",getType())
			.append("Value",getValue())
			.append("CreateTime",getCreateTime())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getAffixId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof ActivityAffix == false) return false;
		if(this == obj) return true;
		ActivityAffix other = (ActivityAffix)obj;
		return new EqualsBuilder()
			.append(getAffixId(),other.getAffixId())
			.isEquals();
	}
}

